package com.itqf.controller;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Description:
 * @Company: 千锋互联
 * @Author: 李丽婷
 * @Date: 2020/10/9
 * @Time: 下午3:24
 */
public class MyFirstController implements Controller {


    /**
     * 处理请求
     * @param request
     * @param response
     * @return
     * @throws Exception
     */
    @Override
    public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
        System.out.println("hello,Springmvc!!!!!");
        //request.getRequestDispatcher("/firts.jsp").forward(request,response);

        ModelAndView  modelAndView = new ModelAndView();
        //视图名称
        modelAndView.setViewName("/first.jsp");//ViewName  页面的名称
        //封装的数据
        modelAndView.addObject("name","我的第一个SpringMVC案例");

        return modelAndView;
    }


}
